<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<#include "/jspgou_sys/head.html"/>
<script type="text/javascript">
$(function() {
	$("#jvForm").validate();
});
function addx(){
	var aa = $("#context").html();
	$("#cc").before(aa);
}
function dele(a){
	var b =$(a).parent();
	$(b).parent().remove();
	
}

function delposter(id){
	$.post("o_delPoster.do",{id:id},function(data){
            if(data=='success'){
                  alert('删除成功');
                }
		});
}

function updateCate(val,id){
	$.post("o_updateCare.do",{val:val,id:id},function(data){
        if(data=='success'){
              alert('修改成功');
            }
	});
}

function updateAll(){
	$("#jvForm").submit();
}
</script>
</head>
<body>
<div class="body-box">
<div class="rhead">
	<div class="rpos"><@s.m "global.position"/>: <@s.m "shop.function.product"/> - <@s.m "product.function"/> - 属性</div>
	<form class="ropt">
		<input type="submit" value="返回列表" onclick="this.form.action='v_list.do';"/>
	</form>
	<div class="clear"></div>
</div>

<form id="jvForm" action="o_update.do" method="post">
<table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">

<tr id="cc"><td class="pn-flabel pn-flabel-h"  width="5%">海报图：</td>
           <td  width="95%" class="pn-fcontent"><input type="button" value="增加图片" onclick="addPicLine()"></td></tr>
<tr><td class="pn-flabel pn-flabel-h"  width="5%"></td>
<td class="pn-fcontent" id="pictures"  width="95%">
<#if listPoster?size gt 0>
<#list listPoster as poster>
<table id="picTable${poster_index}" border="0" style="float: left;">
<tr>
	<td><div>
	  <input type="text" value="${poster.picUrl!}" id="uploadImgPath${poster_index}" name="picUrl"
					style="width: 160px" /> <a href="javascript:void(0);"
					onclick="if(confirm('是否删除')){$('#picTable${poster_index}').remove();delposter('${poster.id}');return true;}else{return false;}" class="pn-opt">删除</a>
					&nbsp;&nbsp;<a href="javascript:void(0);" onclick="updateCate($('#in${poster_index}').val(),${poster.id});">修改链接</a></div>
		<div><span id="ufc${poster_index}">
	            	<input type="file" id="uploadFile${poster_index}" size="10" style="width: 150px" /></span>
					 <input type="button" value="上传" onclick="upload(${poster_index});"/></div>
		<div>宽: <input type="text" id="zoomWidth${poster_index}" value="740" size="5"/>
		             高: <input type="text" id="zoomHeight${poster_index}" value="348" size="5"/>
		        <input type="button" value="<@s.m "imageupload.cut"/>" onclick="imgCut(${poster_index});"/> </div>
		<div><textarea id="in${poster_index}" style="width:200px;height:60px;" name="interUrl" maxlength="255">${poster.interUrl!}</textarea></div>
	</td>
	<td><img src="${uploadRoot}${poster.picUrl}" id="preImg{0}" alt="预览" noResize="true" style="overflow:hidden;width:90px;height:90px;background-color:#ccc;border:1px solid #333"/></td>
</tr>
</table>
</#list>
</#if>
<div id="picBefore" style="clear:both"></div>
</td>
</tr>
</table>
<input type="button" onclick="return updateAll()" value="保存">
</form>
<textarea id="picTable" style="display: none;">
<table id="picTable{0}" border="0" style="float: left;">
<tr>
	<td>
		<div><input type="text" id="uploadImgPath{0}" name="picUrl"
					style="width: 160px" /> <a href="javascript:void(0);"
					onclick="$('#picTable{0}').remove();" class="pn-opt">删除</a></div>
		<div><span id="ufc{0}"><input type="file"
					id="uploadFile{0}" size="10" style="width: 150px" /></span> <input
					type="button" value="上传" onclick="upload({0});"/></div>
		<div>宽: <input type="text" id="zoomWidth0" value="139" size="5"/> 高: <input type="text" id="zoomHeight0" value="139" size="5"/> <input type="button" value="<@s.m "imageupload.cut"/>" onclick="imgCut(0);"/> </div>
		<div>&lt;textarea style="width:200px;height:60px;" name="interUrl" maxlength="255"&gt;&lt;/textarea&gt;</div>
	</td>
	<td><img id="preImg{0}" alt="预览" noResize="true" style="overflow:hidden;width:90px;height:90px;background-color:#ccc;border:1px solid #333"/></td>
</tr>
</table>
</textarea>
<#include "/common/image_upload.html"/>
</body>

<script type="text/javascript">
var picIndex = 0;
<#if listPoster??>
picIndex = ${listPoster?size};
</#if>
	var picTpl = $.format($("#picTable").val());
	function addPicLine() {
		$('#picBefore').before(picTpl(picIndex++));
	}
	
</script>
</html>